package com.seari.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.scheduling.annotation.Scheduled;

public class TaskRunnableTest implements Runnable{

	private int count;
	
	private String crons;
	
	public TaskRunnableTest(int count,String crons) {
		this.count = count;
		this.crons = crons;
	}
	
	

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public static String getCron() {
		return cron;
	}

	public static void setCron(String cron) {
		TaskRunnableTest.cron = cron;
	}



	private static String cron = "0/2 * * * * ?";
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	@Override
	public void run() {
		 System.out.println("---------------start-------------------");
         System.out.println("动态修改定时任务参数，时间表达式cron为：" + crons);
		 System.out.println("当前count 为 ：" + count);
         System.out.println("当前线程为："+Thread.currentThread().getName());
         System.out.println("当前时间为：" + sdf.format(new Date()));
         System.out.println("----------------end--------------------");
	}

}
